//定义一些常量
const TokenKey = 'accessToken'
const RefreshTokenKey = 'refreshToken'

//获取token
export function getToken(){
    return localStorage.getItem(TokenKey) ||''
}

//获取refreshToken
export function getRefreshToken(){
    return localStorage.getItem(RefreshTokenKey)||''
}

//保存token和refreshToken
export function setToken(token,refreshToken){
    localStorage.setItem(TokenKey,token)//将token储存到TokenKey
    localStorage.setItem(RefreshTokenKey,refreshToken)//将refreshToken储存到RefreshTokenKey
}

//清除token和refreshToken
export function clearToken(){
    localStorage.removeItem(TokenKey)
    localStorage.removeItem(RefreshTokenKey)
}

//判断是否为登录状态
export function isLogin(){
    let token=getToken()
    if(token){
        return true
    }else{
        return false
    }
}